package com.ytq.pratice.interview;

import com.ytq.pratice.interview.entity.User;

import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author yuantongqin
 * @date 2018/9/23 上午10:34
 */
public class Swap {

    public static void main(String[] args) {

//        Integer b = 200;
//        Integer a = 10;
//        System.out.println(b + "==" + a);
//
//        User user = new User("张三");
//
//        update(user, b, a);
//        System.out.println(b + "==" + a);
//
//        int aa = a.intValue();
//        System.out.println(aa + "==" + Integer.valueOf(aa));

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = dateFormat.format(new Date());
        System.out.println(format);
        try {
            Date parse = dateFormat.parse("2018-9-25 00:00:00");
            System.out.println(parse.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println(System.currentTimeMillis());

    }

    public static void update(User user, Integer b, int a) {
        b = 290;
        a = 20;

        try {
            Field field = user.getClass().getDeclaredField("value");
            field.setAccessible(true);
//            field.set();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }

    }


}
